const Mock = require('mockjs')

const ThirdbankList=[];
for(let i=0;i<100;i++){
    ThirdbankList.push(
        Mock.mock({
            id:'@increment',
            bankname:'@first',
            banktype:'@integer(0,5)',
            percent:'@integer(100,50000)',
            rate:'@integer(0,5)',
            period:'@integer(0,5)',
            state:'@integer(0,1)',
            remark:'',
            createtime:'@datetime'
        })
    )
}

const LowbillingList=[];
for(let i=0;i<100;i++){
    LowbillingList.push(
        Mock.mock({
            id:'@increment',
            carname:'@first',
            lowprice:'@integer(10,50000)',
            state:'@integer(0,1)',
            remark:'',
            createtime:'@datetime'
        })
    )
}
const AgreementList=[];
for(let i=0;i<100;i++){
    AgreementList.push(
        Mock.mock({
            id:'@increment',
            number:'@integer(1000000,9999999)',
            startdate:'@datetime',
            enddate:'@datetime',
            settlementday:'@integer(0,100)',
            settlementmoney:'@integer(0,100000)',
            purchaser:'@first',
            licenseplate:'@integer(100000,999999)',
            guider:'@first',
            state:'@integer(0,1)',
            remark:'',
            createtime:'@datetime'
        })
    )
}




module.exports=[
    {
        url: '/api/finance/thirdbank',
        type: 'get',
        response: config => {
          const { name, page = 1, limit = 20, sort } = config.query
    
          let mockList = ThirdbankList.filter(item => {
            return true
          })

    
          const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    
          return {
            code: '10000',
            data: {
              total: mockList.length,
              items: pageList
            }
          }
        }
    },
    {
        url: '/api/finance/lowbilling',
        type: 'get',
        response: config => {
          const { name, page = 1, limit = 20, sort } = config.query
    
          let mockList = LowbillingList.filter(item => {
            return true
          })

    
          const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    
          return {
            code: '10000',
            data: {
              total: mockList.length,
              items: pageList
            }
          }
        }
    },
    {
        url: '/api/finance/creditagreement',
        type: 'get',
        response: config => {
          const { name, page = 1, limit = 20, sort } = config.query
    
          let mockList = AgreementList.filter(item => {
            return true
          })

    
          const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    
          return {
            code: '10000',
            data: {
              total: mockList.length,
              items: pageList
            }
          }
        }
    },
]